class Solution {
public:
    int findMaxConsecutiveOnes(vector<int>& nums) {
    int n = nums.size();
    int ans = 0;
    for(int i=0;i<n;i++){
        if(nums[i] == 0) continue;
        int j = i+1;
        while(j<n && nums[j]==1) j++;
        ans = max(ans,j-i);
    }
    return ans;
}
};